Skip to content

REST API endpoints for sites - #13055

Open
lloc wants to merge 4 commits into
WordPress:trunkfrom
lloc:feature/40365-rest-sites-endpoint
Open

REST API endpoints for sites#13055
lloc wants to merge 4 commits into
WordPress:trunkfrom
lloc:feature/40365-rest-sites-endpoint

Conversation

@lloc

@lloc lloc commented Aug 14, 2026

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/40365

There are some open questions that we should discuss in the trac ticket.

@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @jonnydmg.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props realloc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@jonnydmg jonnydmg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a big PR to review. Good work getting this ready for core. This code a little old and some things have changed in core, so this PR needs to update accordingly.

Biggest things.

  • We need to support sites with is_site_meta_supported false. There was some work done there to support it but not complete.
  • Site endpoint needs to be registered on single site. So it always exists then return an error on single site.
  • WP_REST_Site_Meta_Fields has no test coverage at all.
  • Single site needs tests.
  • Super admin should be allowed to do everything on the endpoint.
  • Code coverage and ticket need needs to be added to every test.

This feel like we are on the right track, if I am nitpicing here, becuase I think this good to go into core and just want to get the final bits to push forward into core.

I will wait until feedback is complete to do some real testing for this PR.

Comment thread src/wp-includes/rest-api/endpoints/class-wp-rest-sites-controller.php Outdated
* @since 7.2.0
*
* @group restapi
* @group ms-required

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have another test file for with all the tests related to it not being multisite, as there are lots of checks for is_mulitiste. There are so many this feels like a good fit for another file instead of excloding each test one at a time.

Comment thread src/wp-includes/rest-api.php Outdated
Comment thread src/wp-includes/rest-api/endpoints/class-wp-rest-sites-controller.php Outdated
Comment thread src/wp-includes/rest-api/endpoints/class-wp-rest-sites-controller.php Outdated
Comment thread src/wp-includes/rest-api/endpoints/class-wp-rest-sites-controller.php Outdated

@jonnydmg jonnydmg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a big PR to review. Good work getting this ready for core. This code a little old and some things have changed in core, so this PR needs to update accordingly.

Biggest things.

  • We need to support sites with is_site_meta_supported false. There was some work done there to support it but not complete.
  • Site endpoint needs to be registered on single site. So it always exists then return an error on single site.
  • WP_REST_Site_Meta_Fields has no test coverage at all.
  • Single site needs tests.
  • Super admin should be allowed to do everything on the endpoint.
  • Code coverage and ticket need needs to be added to every test.

This feel like we are on the right track, if I am nitpicing here, becuase I think this good to go into core and just want to get the final bits to push forward into core.

I will wait until feedback is complete to do some real testing for this PR.

Introduces WP_REST_Sites_Controller plus tests.
See #40365.
@lloc
lloc force-pushed the feature/40365-rest-sites-endpoint branch from aa03545 to cc81250 Compare August 22, 2026 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants